package regulator;

public class Format {

}
/*
 * import java.io.*;
 
public class Main {
    static StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
    static PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
 
    public static void main(String[] args) throws Exception {
        int n = nextInt();
        int[] arr = new int[n + 1];
        int[] count = new int[n + 1];
        for (int i = 1; i <= n; i++) {
            arr[i] = nextInt();
            if (arr[i] >= arr[i - 1]) {
                count[i] = count[i - 1] + 1;
            } else {
                count[i] = 1;
            }
        }
        long[] dp = new long[n + 1];
        for (int i = 1; i <= n; i++) {
            dp[i] = dp[i - 1] + count[i];
        }
        System.out.println(dp[n]);
    }
			 
			    static int nextInt() throws Exception {
			        in.nextToken();
			        return (int) in.nval;
    }
}
 * 
 * 
 * 
 */
